export class Result<T> {
    code: string;
    message: string;
    data: T;

    constructor(code: string, message: string, data: T) {
      this.code = code;
      this.message = message;
      this.data = data;
    }

    static ok<T>(data: T): Result<T> {
      return new Result("00000", "success", data);
    }

    static fail<T>(code: string, message: string, data?: T): Result<T> {
      return new Result(code, message, data);
    }
  }

  export class RP<T> extends Result<T> {
    page: number;
    size: number;
    total: number;
  }
